package wwl.lsf.剑指offer;

import wwl.lsf.base.ListNode;

import java.util.LinkedList;
import java.util.List;
import java.util.Stack;

/**
 * @Title
 * @Author wangwenliang
 * @Date 2020/5/29
 * @Description
 */
public class 从尾到头打印链表 {
    public static void main(String[] args) {
        System.out.println(1232);
    }
    public int[] reversePrint(ListNode head) {

        LinkedList<Integer> stack = new LinkedList();
        while (head != null) {
            stack.add(head.val);
        }
        int[] ints = new int[stack.size()];
        for (int i = 0; i < ints.length; i++) {
            ints[i] = stack.removeLast();
        }
        return ints;
    }
}
